package com.umeng.analytics.pro;

import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;

public class cp {
    private final ByteArrayOutputStream a;
    private final dr b;
    private df c;

    public cp() {
        this(new cz.a());
    }

    public cp(dh arg3) {

        this.a = new ByteArrayOutputStream();
        this.b = new dr(this.a);
        this.c = arg3.a(this.b);
    }

    public byte[] a(cg arg2) throws cm {
        this.a.reset();
        arg2.b(this.c);
        return this.a.toByteArray();
    }

    public String a(cg arg4, String arg5) throws cm {
        try {
            return new String(this.a(arg4), arg5);
        }
        catch(UnsupportedEncodingException v0) {
            throw new cm("JVM DOES NOT SUPPORT ENCODING: " + arg5);
        }
    }

    public String b(cg arg3) throws cm {
        return new String(this.a(arg3));
    }
}

